package cn.chencaiju.day11;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;

import org.junit.Test;

public class InputStreamReaderTest {
	public static final String path="read.txt";
	@Test public void testReader() {
		try(
//			InputStreamReader is=new InputStreamReader(new FileInputStream(path),"gbk")
			InputStreamReader is=new InputStreamReader(new FileInputStream(path),"utf-8")	
			)
		{
			char[] chars=new char[100];
			int count=is.read(chars);
			System.out.println(new String(chars,0,count));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e1) {
			e1.printStackTrace();
		}
	}
}
